package com.luyu.service.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.mail.javamail.JavaMailSenderImpl;

import java.util.Properties;

@Configuration
public class MailConfig {
    @Bean
    @ConfigurationProperties(prefix = "spring.mail")
    public JavaMailSenderImpl javaMailSenderImpl(){
        JavaMailSenderImpl mailSender=new JavaMailSenderImpl();
        mailSender.setJavaMailProperties(sendMailProperties());
        return mailSender;
    }
    @Bean
    @ConfigurationProperties(prefix = "spring.mail.properties.mail")
    public Properties sendMailProperties(){
        return new Properties();
    }
}
